package com.um.jdy.platform.platform.controller;

import com.um.jdy.platform.platform.entity.dto.MessagePageDTO;
import com.um.jdy.platform.platform.entity.vo.MessageOverviewVO;
import com.um.jdy.platform.platform.manager.MessageManager;
import com.um.springboot.starter.annotation.ApiPermission;
import com.um.springboot.starter.annotation.TokenRequired;
import com.um.springboot.starter.entity.Page;
import com.um.springboot.starter.orm.controller.BasePlusController;
import com.um.springboot.starter.orm.entity.Response;
import com.um.springboot.starter.orm.manager.BasePlusManager;
import com.um.springboot.starter.orm.params.ListDTO;
import com.um.jdy.common.platform.service.MessageService;
import com.um.jdy.common.platform.entity.po.Message;
import com.um.jdy.common.platform.entity.dto.MessageDTO;
import com.um.jdy.common.platform.entity.vo.MessageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * 控制器：消息表
 */
@RestController
@RequestMapping("/api/v1/cms/platform/message")
@Api(tags = "消息表", description = "MessageController")
@TokenRequired
public class MessageController extends BasePlusController<MessageManager,MessageService,Message,MessageDTO,MessageVO, MessagePageDTO, ListDTO> {

    /**
     * 查询消息概览
     *
     * @return
     */
    @ApiOperation("查询消息概览")
    @GetMapping("overview")
    public Response<MessageOverviewVO> getOverview(){
        return manager.getOverview();
    }

    /**
     * 设置已读
     *
     * @return
     */
    @ApiOperation("设置已读")
    @PutMapping("set_read/{id}")
    public Response setRead(@PathVariable String id){
        return manager.setRead(id);
    }

    /**
     * 设置全部已读
     *
     * @return
     */
    @ApiOperation("设置全部已读")
    @PutMapping("set_all_read")
    public Response setAllRead(){
        return manager.setAllRead();
    }
}
